import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { DetailsSearchQuery, DetailsSearchPageResult } from "./types";

/**
 * 获取码分页数据
 *
 * @param queryParams
 */
export function getDetailsSearchPage(
  queryParams?: DetailsSearchQuery
): AxiosPromise<DetailsSearchPageResult> {
  return request({
    url: "api/Order/OrderLogList",
    method: "post",
    data: queryParams,
  });
}

/**
 * 导出订单
 *
 * @param queryParams
 */
export function exportDetailsSearchPage(
  queryParams?: DetailsSearchQuery
): AxiosPromise<DetailsSearchPageResult> {
  return request({
    url: "api/Order/OrderExport",
    method: "post",
    responseType: "blob",
    data: queryParams,
  });
}

/**
 * 导出配置
 *
 * @param queryParams
 */
export function exportDetailsSearchConfig(
  queryParams?: DetailsSearchQuery
): AxiosPromise<DetailsSearchPageResult> {
  const data = {
    dateStart: "2024-03-29T16:20:06.067Z",
    dateEnd: "2024-03-30T12:51:06.067Z",
    statu: "S111003",
  };
  return request({
    url: "api/Order/ConfigExport",
    method: "post",
    responseType: "blob",
    // data: queryParams,
    data: data,
  });
}

/**
 * 导出提交数据
 *
 * @param queryParams
 */
export function exportDetailsSearchSubmitData(
  queryParams?: DetailsSearchQuery
): AxiosPromise<DetailsSearchPageResult> {
  return request({
    url: "api/Order/SubmitDataExport",
    method: "post",
    responseType: "blob",
    data: queryParams,
  });
}

/**
 * 获取码下拉数据
 *
 * @param queryParams
 */
export function getDetailsSearchOptions(
  queryParams?: DetailsSearchQuery
): AxiosPromise<OptionType[]> {
  return request({
    url: "/api/v1/roles/options",
    method: "get",
    params: queryParams,
  });
}
